package com.example.multithreading;

import java.util.stream.IntStream;

public class ch03_02 {
    public static void main(String[] args) {
        for(int i=0;i<100;i++){
            System.out.println("------------");
            IntStream.range(0,2).mapToObj(ch03_02::createThread).forEach(Thread::start);
        }
    }

    private static Thread createThread(int index){

        return new Thread(()->{
        if(index==0){
            Thread.yield();
        }
            System.out.println(index);

        });


    }
}
